<?php
/**
 * The following variables are available in this template:
 * - $this: the BootCrudCode object
 */
?>
<?php
echo "<?php\n";
echo "\$properties = array(
	'id'=>'".$this->class2id($this->modelClass)."-form',
	'enableAjaxValidation'=>false,
);\n";
echo "\$form = \$this->beginWidget('bootstrap.widgets.TbActiveForm', \$properties);\n";
echo "?>\n";
?>

<p class="help-block">
	Fields with <span class="required">*</span> are required.
</p>

<?php
echo "<?php\n";
echo "echo \$form->errorSummary(\$model);\n";

$excludeColumns = array('createdAt', 'updatedAt', 'createdBy', 'updatedBy');
foreach ($this->tableSchema->columns as $column) {
	if ($column->autoIncrement || array_search($column->name, $excludeColumns) !== FALSE)
		continue;
	
	echo $this->generateActiveRow($this->modelClass, $column);
}

echo "?>\n";
?>

<div class="form-actions">
	<?php
	echo "<?php\n\t";
	echo "\$properties = array(
		'buttonType'=>'submit',
		'type'=>'primary',
		'label'=>\$model->isNewRecord ? 'Create' : 'Save',
	);\n\t";
	echo "\$this->widget('bootstrap.widgets.TbButton', \$properties);";
	echo "\n\t?>\n";
	?>
</div>

<?php echo "<?php \$this->endWidget(); ?>\n"; ?>
